package com.bmslz.monitor.controller;

import com.bmslz.monitor.helper.DashboardHelper;
import com.bmslz.monitor.helper.LoginHelper;
import com.bmslz.monitor.base.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 大屏/统计
 * @Author: yry
 * @Date: 2025-08-30
 * @Version: V1.0
 */
@Slf4j
@Api(tags = "大屏/统计")
@RestController
@RequestMapping("/sys/dashboard")
public class DashboardController {
    @Autowired
    private DashboardHelper dashboardHelper;

    /**
     * 项目数量、用户数、模型数、告警模板数、测点数据量、当前告警数等卡片统计数据
     *
     * @return
     */
    @ApiOperation(value = "项目数量、用户数、模型数、告警模板数、测点数据量、当前告警数等卡片统计数据",
            notes = "项目数量、用户数、模型数、告警模板数、测点数据量、当前告警数等卡片统计数据")
    @GetMapping(value = "/super/card")
    public Result<?> superCard() {
        LoginHelper.closeUserIsolation();
        return Result.OK(dashboardHelper.superCard());
    }

    /**
     * 探针数据qps监控
     *
     * @return
     */
    @ApiOperation(value = "探针数据qps监控", notes = "探针数据qps监控")
    @GetMapping(value = "/super/qps")
    public Result<?> userInfo() {
        return Result.OK(dashboardHelper.superQps());
    }
    /**
     * 分别统计三种告警等级的数量
     *
     * @return
     */
    @ApiOperation(value = "告警项目统计", notes = "告警项目统计")
    @GetMapping(value = "/super/project/alarm-group")
    public Result<?> projectAlarmGroup() {
        return Result.OK(dashboardHelper.projectAlarmGroup());
    }
}
